import 'package:flutter/material.dart';
import 'second.dart';

void main() => runApp(new ArchivesApp());

class ArchivesApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      theme: new ThemeData(primarySwatch: Colors.red),
      home: new HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  HomePageState createState() => new HomePageState();
}

class HomePageState extends State<HomePage> {
  void _login() {
    Navigator.pushReplacement(
        context, new MaterialPageRoute(builder: (context) => new SecondPage()));
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new Center(
        child: new Column(
          children: <Widget>[
            new Container(
              margin: const EdgeInsets.fromLTRB(40.0, 100.0, 40.0, 0.0),
              child: new Row(
                mainAxisAlignment: MainAxisAlignment.center,
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  new Expanded(
                    child: new Text(
                      "浙江新闻",
                      style: new TextStyle(fontSize: 30.0),
                    ),
                  ),
                  new Image.asset(
                    "images/gh.png",
                    width: 65.0,
                    height: 65.0,
                  )
                ],
              ),
            ),
            new Container(
              margin: const EdgeInsets.fromLTRB(40.0, 50.0, 40.0, 0.0),
              child: new Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  new TextField(
                    decoration: new InputDecoration(hintText: "请输入手机号"),
                  ),
                  new Container(
                    margin: const EdgeInsets.only(top: 10.0),
                    child: new Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      mainAxisSize: MainAxisSize.min,
                      children: <Widget>[
                        new Expanded(
                          child: new TextField(
                            decoration: new InputDecoration(hintText: "请输入验证码"),
                          ),
                        ),
                        new MaterialButton(
                          colorBrightness: Brightness.dark,
                          color: Colors.red,
                          padding:
                              const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0),
                          onPressed: _login,
                          child: new Text("获取验证码"),
                        )
                      ],
                    ),
                  )
                ],
              ),
            ),
            new Expanded(
                child: new Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                new Expanded(
                  child: new Container(
                    margin: const EdgeInsets.fromLTRB(40.0, 0.0, 40.0, 0.0),
                    child: new MaterialButton(
                      onPressed: _login,
                      colorBrightness: Brightness.dark,
                      color: Colors.red,
                      padding: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0),
                      child: new Text(
                        "登录",
                        style: new TextStyle(fontSize: 18.0),
                      ),
                    ),
                  ),
                ),
              ],
            ))
          ],
        ),
      ),
    );
  }
}
